-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditionally use esm
package
#499
base: master
Are you sure you want to change the base?
Conversation
@@ -1,8 +1,5 @@ | |||
import path from 'path'; | |||
import findup from 'findup-sync'; | |||
import esm from 'esm'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the main fix here. importing esm
cannot happen in module-space because of the hax it employs.
} catch { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires, node/no-missing-require | ||
const esm = require('esm'); | ||
const esmRequire = esm(module); | ||
|
||
brocfile = esmRequire(brocfilePath); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check the specific error code and only fallback to the esm version if we don't have some other (userland) error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't get this project to run at all locally, so so I can't see what error is thrown
I can confirm that removing the |
Resolves: #498
Tested on: https://stackblitz.com/github/nullvoxpopuli/broccoli/tree/remove-esm
(for which the
esm
package does not work at all)